Fix handling of alpha when using luma file - #1276
Conversation
|
Hmm don't know how but it's only now that I realize that there is an issue with my change, bottom left part of the blue triangle is missing.. |
There was a problem hiding this comment.
Pull request overview
This PR updates the core luma transition implementation to make alpha handling consistent when a luma file is used, by ensuring the luma-based compositing path respects the alpha_over setting instead of implicitly behaving as if alpha_over were enabled.
Changes:
- Add an
alpha_overparameter to the luma compositing functions (YUV422/RGBA32/RGBA64) and thread it throughtransition_get_image. - Gate the “alpha-over” normalization/alpha-channel updates in the luma compositing loops behind
alpha_over.
Comments suppressed due to low confidence (1)
src/modules/core/transition_luma.c:438
- In the translucent+YUV422 luma path, the alpha pointers are advanced linearly across pixels (immediately after this block) but are not re-based per row/field or adjusted for differing src/dst row strides. If frames are interlaced (
field_count=2) or src/dst dimensions differ, alpha reads/writes can become misaligned and produce incorrect alpha output.
}
*q = sample_mix(*q, *p++, mix_b);
q++;
|
So my last commit fixes the compositing when a luma file is used. First frame (only first red triangle visible: Last frame (Second blue triangle visible with the first red triangle visible below if alpha_over is disabled) : Now regarding copilot review, it is related to the case where Even stranger, in But in luma_composite_rgba32 and luma_composite_rgba64, the case where invert is enabled executes exactly the same code as when disabled - code is duplicated in the 2 cases. So in my opinion the |


Currently, the luma transition behaves differently when using a luma file or not on images with an alpha channel. When a luma file is used, it always behaves as if alpha_over was enabled. Here are some screenshot comparing a transition between 2 images of triangles with a transparent background. Each image below contains 4 different cases:
Frame 0: only first image is visible (red triangle in top right corner):
Last frame of the transition, you can see the behavior difference when a luma is used or not (bottom left should be similar to top left):
With the changes in this merge request, the result is now as expected:
The only question is do we want to maintain backwards compatibility, and how ?
Feedback is welcome.